<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 5.4.2">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha256-HtsXJanqjKTc8vVQjO4YMhiqFoXkfBsjBWcX91T1jr8=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"xiaoqingming18.github.io","root":"/","images":"/images","scheme":"Muse","darkmode":false,"version":"8.15.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":false,"style":null},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"}}</script><script src="/js/config.js"></script>

    <meta name="description" content="SQL笔记第1课 检索数据1.1 检索单个列简单的SQLSELECT语句如下： 12SELECT prod_nameFROM Products; SQL语句不区分大小写，但通常习惯对SQL关键字使用大写，对列表和表名使用小写。 1.2 检索多个列要从一个表中检索多个列，可以在SELECT关键字后面给出多个列名，列名之间用逗号分隔。 下面的语句从Products表中选择3列： 12SELECT pr">
<meta property="og:type" content="article">
<meta property="og:title" content="SQL笔记">
<meta property="og:url" content="http://xiaoqingming18.github.io/2023/04/23/%E6%95%B0%E6%8D%AE%E5%BA%93%E5%8E%9F%E7%90%86%EF%BC%9ASQL/index.html">
<meta property="og:site_name" content="鸣蜩十七">
<meta property="og:description" content="SQL笔记第1课 检索数据1.1 检索单个列简单的SQLSELECT语句如下： 12SELECT prod_nameFROM Products; SQL语句不区分大小写，但通常习惯对SQL关键字使用大写，对列表和表名使用小写。 1.2 检索多个列要从一个表中检索多个列，可以在SELECT关键字后面给出多个列名，列名之间用逗号分隔。 下面的语句从Products表中选择3列： 12SELECT pr">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2023-04-23T05:44:46.000Z">
<meta property="article:modified_time" content="2023-05-11T13:49:27.117Z">
<meta property="article:author" content="鸣蜩十七">
<meta property="article:tag" content="-SQL -数据库">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="http://xiaoqingming18.github.io/2023/04/23/%E6%95%B0%E6%8D%AE%E5%BA%93%E5%8E%9F%E7%90%86%EF%BC%9ASQL/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://xiaoqingming18.github.io/2023/04/23/%E6%95%B0%E6%8D%AE%E5%BA%93%E5%8E%9F%E7%90%86%EF%BC%9ASQL/","path":"2023/04/23/数据库原理：SQL/","title":"SQL笔记"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>SQL笔记 | 鸣蜩十七</title>
  








  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>

<style>.github-emoji { position: relative; display: inline-block; width: 1.2em; min-height: 1.2em; overflow: hidden; vertical-align: top; color: transparent; }  .github-emoji > span { position: relative; z-index: 10; }  .github-emoji img, .github-emoji .fancybox { margin: 0 !important; padding: 0 !important; border: none !important; outline: none !important; text-decoration: none !important; user-select: none !important; cursor: auto !important; }  .github-emoji img { height: 1.2em !important; width: 1.2em !important; position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; user-select: none !important; cursor: auto !important; } .github-emoji-fallback { color: inherit; } .github-emoji-fallback img { opacity: 0 !important; }</style>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">鸣蜩十七</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">鸣蜩十七是和女朋友谈恋爱的日子</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li><li class="menu-item menu-item-schedule"><a href="/schedule/" rel="section"><i class="fa fa-calendar fa-fw"></i>日程表</a></li><li class="menu-item menu-item-sitemap"><a href="/sitemap.xml" rel="section"><i class="fa fa-sitemap fa-fw"></i>站点地图</a></li><li class="menu-item menu-item-commonweal"><a href="/404/" rel="section"><i class="fa fa-heartbeat fa-fw"></i>公益 404</a></li>
  </ul>
</nav>




</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#SQL%E7%AC%94%E8%AE%B0"><span class="nav-text">SQL笔记</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%AC%AC1%E8%AF%BE-%E6%A3%80%E7%B4%A2%E6%95%B0%E6%8D%AE"><span class="nav-text">第1课 检索数据</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1-%E6%A3%80%E7%B4%A2%E5%8D%95%E4%B8%AA%E5%88%97"><span class="nav-text">1.1 检索单个列</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2-%E6%A3%80%E7%B4%A2%E5%A4%9A%E4%B8%AA%E5%88%97"><span class="nav-text">1.2 检索多个列</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-3-%E6%A3%80%E7%B4%A2%E6%89%80%E6%9C%89%E5%88%97"><span class="nav-text">1.3 检索所有列</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-4-%E6%A3%80%E7%B4%A2%E4%B8%8D%E5%90%8C%E7%9A%84%E5%80%BC%EF%BC%88%E5%8E%BB%E9%99%A4%E9%87%8D%E5%A4%8D%E5%80%BC%EF%BC%89"><span class="nav-text">1.4 检索不同的值（去除重复值）</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-5-%E9%99%90%E5%88%B6%E7%BB%93%E6%9E%9C"><span class="nav-text">1.5 限制结果</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%AC%AC2%E8%AF%BE-%E6%8E%92%E5%BA%8F%E6%A3%80%E7%B4%A2%E6%95%B0%E6%8D%AE"><span class="nav-text">第2课 排序检索数据</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-%E6%8E%92%E5%BA%8F%E6%95%B0%E6%8D%AE"><span class="nav-text">2.1 排序数据</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-%E6%8C%89%E5%A4%9A%E4%B8%AA%E5%88%97%E6%8E%92%E5%BA%8F"><span class="nav-text">2.2 按多个列排序</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-%E6%8C%87%E5%AE%9A%E6%8E%92%E5%BA%8F%E6%96%B9%E5%90%91"><span class="nav-text">2.3 指定排序方向</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-4-%E5%B0%8F%E7%BB%93"><span class="nav-text">2.4 小结</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%AC%AC3%E8%AF%BE-%E8%BF%87%E6%BB%A4%E6%95%B0%E6%8D%AE"><span class="nav-text">第3课 过滤数据</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-WHERE%E5%AD%90%E5%8F%A5"><span class="nav-text">3.1 WHERE子句</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-WHERE%E5%AD%90%E5%8F%A5%E6%93%8D%E4%BD%9C%E7%AC%A6"><span class="nav-text">3.2 WHERE子句操作符</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#3-2-1-%E6%A3%80%E6%9F%A5%E5%8D%95%E4%B8%AA%E5%80%BC"><span class="nav-text">3.2.1 检查单个值</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-2-2-%E4%B8%8D%E5%8C%B9%E9%85%8D%E6%A3%80%E6%9F%A5"><span class="nav-text">3.2.2 不匹配检查</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-2-3-%E8%8C%83%E5%9B%B4%E5%80%BC%E6%A3%80%E6%9F%A5"><span class="nav-text">3.2.3 范围值检查</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-2-4-%E7%A9%BA%E5%80%BC%E6%A3%80%E6%9F%A5"><span class="nav-text">3.2.4 空值检查</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%AC%AC4%E8%AF%BE-%E9%AB%98%E7%BA%A7%E6%95%B0%E6%8D%AE%E8%BF%87%E6%BB%A4"><span class="nav-text">第4课 高级数据过滤</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#4-1-%E7%BB%84%E5%90%88WHERE%E5%AD%90%E5%8F%A5"><span class="nav-text">4.1 组合WHERE子句</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#4-1-1-AND%E6%93%8D%E4%BD%9C%E7%AC%A6"><span class="nav-text">4.1.1 AND操作符</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#4-1-2-OR%E6%93%8D%E4%BD%9C%E7%AC%A6"><span class="nav-text">4.1.2 OR操作符</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#4-1-3-%E6%B1%82%E5%80%BC%E9%A1%BA%E5%BA%8F"><span class="nav-text">4.1.3 求值顺序</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-2-IN%E6%93%8D%E4%BD%9C%E7%AC%A6"><span class="nav-text">4.2 IN操作符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-3-NOT%E6%93%8D%E4%BD%9C%E7%AC%A6"><span class="nav-text">4.3 NOT操作符</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%AC%AC5%E8%AF%BE-%E7%94%A8%E9%80%9A%E9%85%8D%E7%AC%A6%E8%BF%9B%E8%A1%8C%E8%BF%87%E6%BB%A4"><span class="nav-text">第5课 用通配符进行过滤</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#5-1-LIKE%E6%93%8D%E4%BD%9C%E7%AC%A6"><span class="nav-text">5.1 LIKE操作符</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#5-1-1-%E7%99%BE%E5%88%86%E5%8F%B7-%E9%80%9A%E9%85%8D%E7%AC%A6"><span class="nav-text">5.1.1 百分号%通配符</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#5-1-2-%E4%B8%8B%E5%88%92%E7%BA%BF-%E9%80%9A%E9%85%8D%E7%AC%A6"><span class="nav-text">5.1.2 下划线_通配符</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#5-1-3-%E6%96%B9%E6%8B%AC%E5%8F%B7-%E9%80%9A%E9%85%8D%E7%AC%A6"><span class="nav-text">5.1.3 方括号[ ]通配符</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%AC%AC6%E8%AF%BE-%E5%88%9B%E5%BB%BA%E8%AE%A1%E7%AE%97%E5%AD%97%E6%AE%B5"><span class="nav-text">第6课 创建计算字段</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#6-1-%E8%AE%A1%E7%AE%97%E5%AD%97%E6%AE%B5"><span class="nav-text">6.1 计算字段</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-2-%E6%8B%BC%E6%8E%A5%E5%AD%97%E6%AE%B5"><span class="nav-text">6.2 拼接字段</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-3-%E4%BD%BF%E7%94%A8%E5%88%AB%E5%90%8D"><span class="nav-text">6.3 使用别名</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-4-%E6%89%A7%E8%A1%8C%E7%AE%97%E6%95%B0%E8%AE%A1%E7%AE%97"><span class="nav-text">6.4 执行算数计算</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%AC%AC7%E8%AF%BE-%E4%BD%BF%E7%94%A8%E5%87%BD%E6%95%B0%E5%A4%84%E7%90%86%E6%95%B0%E6%8D%AE"><span class="nav-text">第7课 使用函数处理数据</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%AC%AC8%E8%AF%BE-%E5%88%86%E7%BB%84%E6%95%B0%E6%8D%AE"><span class="nav-text">第8课 分组数据</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#8-1-%E5%88%9B%E5%BB%BA%E5%88%86%E7%BB%84"><span class="nav-text">8.1 创建分组</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">鸣蜩十七</p>
  <div class="site-description" itemprop="description">记录我的学习、生活和恋爱日常</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">43</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">8</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">37</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://xiaoqingming18.github.io/2023/04/23/%E6%95%B0%E6%8D%AE%E5%BA%93%E5%8E%9F%E7%90%86%EF%BC%9ASQL/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="鸣蜩十七">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="鸣蜩十七">
      <meta itemprop="description" content="记录我的学习、生活和恋爱日常">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="SQL笔记 | 鸣蜩十七">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          SQL笔记
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2023-04-23 13:44:46" itemprop="dateCreated datePublished" datetime="2023-04-23T13:44:46+08:00">2023-04-23</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2023-05-11 21:49:27" itemprop="dateModified" datetime="2023-05-11T21:49:27+08:00">2023-05-11</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E6%95%B0%E6%8D%AE%E5%BA%93%E5%8E%9F%E7%90%86/" itemprop="url" rel="index"><span itemprop="name">-数据库原理</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h1 id="SQL笔记"><a href="#SQL笔记" class="headerlink" title="SQL笔记"></a>SQL笔记</h1><h2 id="第1课-检索数据"><a href="#第1课-检索数据" class="headerlink" title="第1课 检索数据"></a>第1课 检索数据</h2><h3 id="1-1-检索单个列"><a href="#1-1-检索单个列" class="headerlink" title="1.1 检索单个列"></a>1.1 检索单个列</h3><p>简单的SQL<code>SELECT</code>语句如下：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products;</span><br></pre></td></tr></tbody></table></figure>
<p>SQL语句不区分大小写，但通常习惯对SQL关键字使用大写，对列表和表名使用小写。</p>
<h3 id="1-2-检索多个列"><a href="#1-2-检索多个列" class="headerlink" title="1.2 检索多个列"></a>1.2 检索多个列</h3><p>要从一个表中检索多个列，可以在<code>SELECT</code>关键字后面给出多个列名，列名之间用逗号分隔。</p>
<p>下面的语句从<code>Products</code>表中选择3列：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_id,prod_name,prod_price</span><br><span class="line"><span class="keyword">FROM</span> Products;</span><br></pre></td></tr></tbody></table></figure>
<h3 id="1-3-检索所有列"><a href="#1-3-检索所有列" class="headerlink" title="1.3 检索所有列"></a>1.3 检索所有列</h3><p>要检索所有列，可以在实际列名的位置使用星号（*）通配符：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> <span class="operator">*</span></span><br><span class="line"><span class="keyword">FROM</span> Products;</span><br></pre></td></tr></tbody></table></figure>
<h3 id="1-4-检索不同的值（去除重复值）"><a href="#1-4-检索不同的值（去除重复值）" class="headerlink" title="1.4 检索不同的值（去除重复值）"></a>1.4 检索不同的值（去除重复值）</h3><p>使用<code>DISTINCT</code>关键字可以指示数据库返回不同的值，也即去除重复值：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> <span class="keyword">DISTINCT</span> vend_id</span><br><span class="line"><span class="keyword">FROM</span> Products;</span><br></pre></td></tr></tbody></table></figure>
<h3 id="1-5-限制结果"><a href="#1-5-限制结果" class="headerlink" title="1.5 限制结果"></a>1.5 限制结果</h3><p>有时可能只想返回第一行或者一定数量的行，各种数据库对这一功能实现的SQL语句不同。</p>
<p>在SQL Server中，可以使用<code>TOP</code>关键字来限制最多返回多少行，如下所示：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> TOP <span class="number">5</span> prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products;</span><br></pre></td></tr></tbody></table></figure>
<p>上面的代码使用<code>SELECT TOP 5</code>语句，只检索前5行数据。</p>
<h2 id="第2课-排序检索数据"><a href="#第2课-排序检索数据" class="headerlink" title="第2课 排序检索数据"></a>第2课 排序检索数据</h2><h3 id="2-1-排序数据"><a href="#2-1-排序数据" class="headerlink" title="2.1 排序数据"></a>2.1 排序数据</h3><p>使用<code>ORDER BY</code>子句，可以对<code>SELECT</code>语句检索出来的数据进行排序：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">ORDER</span> <span class="keyword">BY</span> prod_name;</span><br></pre></td></tr></tbody></table></figure>
<p>上面的语句指示DBMS软件对<code>prod_name</code>列以字母顺序排序数据。</p>
<p>要注意的是，<code>ORDER BY</code>子句必须是<code>SELECT</code>语句中的最后一条子句，否则将会出错。</p>
<h3 id="2-2-按多个列排序"><a href="#2-2-按多个列排序" class="headerlink" title="2.2 按多个列排序"></a>2.2 按多个列排序</h3><p><code>ORDER BY</code>子句可以对多个列进行排序，可以在其后给出多个列名，用逗号分隔，并且排列权重从第一个列名往后依次下降。看下面的例子：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_id,prod_price,prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">ORDER</span> <span class="keyword">BY</span> prod_price,prod_name;</span><br></pre></td></tr></tbody></table></figure>
<p>上面的语句首先按价格排序，然后按名称排序。也即当价格相同时，按名称排序。</p>
<h3 id="2-3-指定排序方向"><a href="#2-3-指定排序方向" class="headerlink" title="2.3 指定排序方向"></a>2.3 指定排序方向</h3><p>数据排序默认升序排序（从A到Z），还可以使用<code>ORDER BY</code>子句进行降序排序。为了进行降序排序，必须指定<code>DESC</code>关键字，下面的例子以价格降序来排序产品：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_id,prod_price,prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">ORDER</span> <span class="keyword">BY</span> prod_price <span class="keyword">DESC</span>;</span><br></pre></td></tr></tbody></table></figure>
<p>要注意的是，<code>DESC</code>关键字只应用到直接位于其前面的列名，来看下面的例子：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_id,prod_price,prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">ORDER</span> <span class="keyword">BY</span> prod_price <span class="keyword">DESC</span> prod_name;</span><br></pre></td></tr></tbody></table></figure>
<p>这个例子中，只对产品价格进行降序排序，当产品价格相同时，按产品名称升序排序。</p>
<h3 id="2-4-小结"><a href="#2-4-小结" class="headerlink" title="2.4 小结"></a>2.4 小结</h3><ol>
<li><code>ORDER BY</code>子句必须是<code>SELECT</code>语句中的最后一条子句，否则将会出错；</li>
<li><code>ORDER BY</code>子句可以对多个列进行排序，可以在其后给出多个列名，用逗号分隔，并且排列权重从第一个列名往后依次下降；</li>
<li>在要进行降序排序后面的列名使用<code>DESC</code>关键字，其他列名没有使用<code>DESC</code>关键字则继续默认升序排序。</li>
</ol>
<h2 id="第3课-过滤数据"><a href="#第3课-过滤数据" class="headerlink" title="第3课 过滤数据"></a>第3课 过滤数据</h2><h3 id="3-1-WHERE子句"><a href="#3-1-WHERE子句" class="headerlink" title="3.1 WHERE子句"></a>3.1 WHERE子句</h3><p>在<code>SELECT</code>语句中，数据根据<code>WHERE</code>子句中指定的搜索条件进行过滤，<code>WHERE</code>子句在表名（<code>FROM</code>子句）之后给出，看下面的例子：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_name,prod_price</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">WHERE</span> prod_price <span class="operator">=</span> <span class="number">3.94</span>;</span><br></pre></td></tr></tbody></table></figure>
<p>上面的语句从<code>Products</code>表中返回价格为3.94的行。</p>
<h3 id="3-2-WHERE子句操作符"><a href="#3-2-WHERE子句操作符" class="headerlink" title="3.2 WHERE子句操作符"></a>3.2 WHERE子句操作符</h3><div class="table-container">
<table>
<thead>
<tr>
<th>操作符</th>
<th>说明</th>
<th>操作符</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>=</td>
<td>等于</td>
<td>&gt;</td>
<td>大于</td>
</tr>
<tr>
<td>&lt;&gt;</td>
<td>不等于</td>
<td>&gt;=</td>
<td>大于等于</td>
</tr>
<tr>
<td>!=</td>
<td>不等于</td>
<td>!&gt;</td>
<td>不大于</td>
</tr>
<tr>
<td>&lt;</td>
<td>小于</td>
<td>BETWEEN</td>
<td>在指定的两个值中间</td>
</tr>
<tr>
<td>&lt;=</td>
<td>小于等于</td>
<td>IS NULL</td>
<td>为NULL值</td>
</tr>
<tr>
<td>!&lt;</td>
<td>不小于</td>
<td></td>
</tr>
</tbody>
</table>
</div>
<h4 id="3-2-1-检查单个值"><a href="#3-2-1-检查单个值" class="headerlink" title="3.2.1 检查单个值"></a>3.2.1 检查单个值</h4><p>列出所有价格小于10元的产品：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_name,prod_price</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">WHERE</span> prod_price <span class="operator">&lt;</span> <span class="number">10</span>;</span><br></pre></td></tr></tbody></table></figure>
<h4 id="3-2-2-不匹配检查"><a href="#3-2-2-不匹配检查" class="headerlink" title="3.2.2 不匹配检查"></a>3.2.2 不匹配检查</h4><p>列出所有不是供应商DLL01制造的产品：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> vend_id,prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">WHERE</span> vend_id <span class="operator">&lt;&gt;</span> <span class="string">'DLL01'</span>;</span><br></pre></td></tr></tbody></table></figure>
<h4 id="3-2-3-范围值检查"><a href="#3-2-3-范围值检查" class="headerlink" title="3.2.3 范围值检查"></a>3.2.3 范围值检查</h4><p>要检查某个范围的值，可以使用<code>BETWEEN</code>操作符。</p>
<p>检索价格在5元和10元之间的所有产品：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_name,prod_price</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">WHERE</span> prod_price <span class="keyword">BETWEEN</span> <span class="number">5</span> <span class="keyword">AND</span> <span class="number">10</span>;</span><br></pre></td></tr></tbody></table></figure>
<p>从上面的例子可以看出，范围两个值用<code>AND</code>关键字隔开，并且检索结果包括指定的开始值和结束值。</p>
<h4 id="3-2-4-空值检查"><a href="#3-2-4-空值检查" class="headerlink" title="3.2.4 空值检查"></a>3.2.4 空值检查</h4><p>返回没有价格的产品：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">WHERE</span> prod_price <span class="keyword">IS</span> <span class="keyword">NULL</span>;</span><br></pre></td></tr></tbody></table></figure>
<h2 id="第4课-高级数据过滤"><a href="#第4课-高级数据过滤" class="headerlink" title="第4课 高级数据过滤"></a>第4课 高级数据过滤</h2><h3 id="4-1-组合WHERE子句"><a href="#4-1-组合WHERE子句" class="headerlink" title="4.1 组合WHERE子句"></a>4.1 组合WHERE子句</h3><p>SQL允许给出多个<code>WHERE</code>子句，这些子句可以通过<code>AND</code>或<code>OR</code>操作符使用。</p>
<h4 id="4-1-1-AND操作符"><a href="#4-1-1-AND操作符" class="headerlink" title="4.1.1 AND操作符"></a>4.1.1 AND操作符</h4><p>如果有多个过滤条件，可以使用<code>AND</code>操作符给<code>WHERE</code>子句附加条件，用<code>AND</code>分隔多个条件：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_id,prod_price,prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">WHERE</span> vend_id <span class="operator">=</span> <span class="string">'DLL01'</span> <span class="keyword">AND</span> prod_priece <span class="operator">&lt;=</span> <span class="number">4</span>;</span><br></pre></td></tr></tbody></table></figure>
<p>上面的SQL语句检索由供应商DLL01制造且价格小于等于4元的所有产品。</p>
<h4 id="4-1-2-OR操作符"><a href="#4-1-2-OR操作符" class="headerlink" title="4.1.2 OR操作符"></a>4.1.2 OR操作符</h4><p><code>OR</code>操作符与<code>AND</code>操作符相反，用<code>OR</code>操作符分隔的多个条件只要满足一个即可：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_id,prod_price,prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">WHERE</span> vend_id <span class="operator">=</span> <span class="string">'DLL01'</span> <span class="keyword">OR</span> vend_id <span class="operator">=</span> <span class="string">'BRS01'</span>;</span><br></pre></td></tr></tbody></table></figure>
<p>上面的SQL语句检索由DLL01或BRS01供应商制造的所有产品。</p>
<h4 id="4-1-3-求值顺序"><a href="#4-1-3-求值顺序" class="headerlink" title="4.1.3 求值顺序"></a>4.1.3 求值顺序</h4><p>当<code>WHERE</code>子句包含多个<code>AND</code>和<code>OR</code>操作符时，会优先处理<code>AND</code>操作符，我们可以用圆括号对操作符进行明确分组，来看下面的例子：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_name,prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">WHERE</span> (vend_id <span class="operator">=</span> <span class="string">'DLL91'</span> <span class="keyword">OR</span> vend_id <span class="operator">=</span> <span class="string">'BRS01'</span>)</span><br><span class="line">	<span class="keyword">AND</span> prod_price <span class="operator">&gt;=</span> <span class="number">10</span>;</span><br></pre></td></tr></tbody></table></figure>
<h3 id="4-2-IN操作符"><a href="#4-2-IN操作符" class="headerlink" title="4.2 IN操作符"></a>4.2 IN操作符</h3><p><code>IN</code>操作符用来指定条件范围，范围中的每个条件都可以进行匹配。<code>IN</code>取一组由逗号分隔、括在圆括号里的合法值。</p>
<p>看下面的例子：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_name,prod_price</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">WHERE</span> vend_id <span class="keyword">IN</span> (<span class="string">'DLL01'</span>,<span class="string">'BRS01'</span>)</span><br><span class="line"><span class="keyword">ORDER</span> <span class="keyword">BY</span> prod_name;</span><br></pre></td></tr></tbody></table></figure>
<h3 id="4-3-NOT操作符"><a href="#4-3-NOT操作符" class="headerlink" title="4.3 NOT操作符"></a>4.3 NOT操作符</h3><p><code>NOT</code>操作符用于否定其后所跟的任何条件，要放在列名前面：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">WHERE</span> <span class="keyword">NOT</span> vend_id <span class="operator">=</span> <span class="string">'DLL01'</span></span><br><span class="line"><span class="keyword">ORDER</span> <span class="keyword">BY</span> prod_name;</span><br></pre></td></tr></tbody></table></figure>
<h2 id="第5课-用通配符进行过滤"><a href="#第5课-用通配符进行过滤" class="headerlink" title="第5课 用通配符进行过滤"></a>第5课 用通配符进行过滤</h2><h3 id="5-1-LIKE操作符"><a href="#5-1-LIKE操作符" class="headerlink" title="5.1 LIKE操作符"></a>5.1 LIKE操作符</h3><p>可以使用<code>LIKE</code>操作符在搜索子句中使用通配符进行模糊匹配。</p>
<h4 id="5-1-1-百分号-通配符"><a href="#5-1-1-百分号-通配符" class="headerlink" title="5.1.1 百分号%通配符"></a>5.1.1 百分号%通配符</h4><p>%表示任何字符出现任意次数。</p>
<p>例如查找所有以词Fish起头的产品：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_id,prod_name</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">WHERE</span> prod_name <span class="keyword">LIKE</span> <span class="string">'Fish%'</span>;</span><br></pre></td></tr></tbody></table></figure>
<p>需要特别注意，%还能匹配0个字符。</p>
<h4 id="5-1-2-下划线-通配符"><a href="#5-1-2-下划线-通配符" class="headerlink" title="5.1.2 下划线_通配符"></a>5.1.2 下划线_通配符</h4><p>下划线_只匹配单个任意字符。</p>
<h4 id="5-1-3-方括号-通配符"><a href="#5-1-3-方括号-通配符" class="headerlink" title="5.1.3 方括号[ ]通配符"></a>5.1.3 方括号[ ]通配符</h4><p>方括号[ ]用来指定一个字符集，它必须匹配指定位置（通配符位置）的一个字符。简单来说，方括号内的多个字符只需要匹配一个即可。</p>
<p>例如，找出所有名字以J或M开头的联系人：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> cust_contact</span><br><span class="line"><span class="keyword">FROM</span> Customers</span><br><span class="line"><span class="keyword">WHERE</span> cust_contact <span class="keyword">LIKE</span> <span class="string">'[JM]%'</span></span><br></pre></td></tr></tbody></table></figure>
<h2 id="第6课-创建计算字段"><a href="#第6课-创建计算字段" class="headerlink" title="第6课 创建计算字段"></a>第6课 创建计算字段</h2><h3 id="6-1-计算字段"><a href="#6-1-计算字段" class="headerlink" title="6.1 计算字段"></a>6.1 计算字段</h3><p>计算字段并不实际存在于数据库表中，计算字段是运行时在<code>SELECT</code>语句内创建的。</p>
<h3 id="6-2-拼接字段"><a href="#6-2-拼接字段" class="headerlink" title="6.2 拼接字段"></a>6.2 拼接字段</h3><p>要拼接字段，可以使用<code>+</code>或<code>||</code>表示，SQL Server中使用<code>+</code>来拼接字段。</p>
<p>例如，要在输出供应商名称的同时输出他们的位置：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> vend_name <span class="operator">+</span> <span class="string">'('</span> <span class="operator">+</span> vend_country <span class="operator">+</span> <span class="string">')'</span></span><br><span class="line"><span class="keyword">FROM</span> Vendors</span><br><span class="line"><span class="keyword">ORDER</span> <span class="keyword">BY</span> vend_name;</span><br></pre></td></tr></tbody></table></figure>
<h3 id="6-3-使用别名"><a href="#6-3-使用别名" class="headerlink" title="6.3 使用别名"></a>6.3 使用别名</h3><p>别名用<code>AS</code>关键字赋予，看下面的例子：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> vend_name <span class="operator">+</span> <span class="string">'('</span> <span class="operator">+</span> vend_country <span class="operator">+</span> <span class="string">')'</span> <span class="keyword">AS</span> vend_title</span><br><span class="line"><span class="keyword">FROM</span> Vendors</span><br><span class="line"><span class="keyword">ORDER</span> <span class="keyword">BY</span> vend_name;</span><br></pre></td></tr></tbody></table></figure>
<h3 id="6-4-执行算数计算"><a href="#6-4-执行算数计算" class="headerlink" title="6.4 执行算数计算"></a>6.4 执行算数计算</h3><p>可以在<code>SELECT</code>语句中使用加（+）减（-）乘（*）除（/）运算。</p>
<p>例如，输出某一个订单中的所有商品信息及每类商品总价：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> prod_id,quantity,item_price,quantity<span class="operator">*</span>item_price <span class="keyword">AS</span> expanded_price</span><br><span class="line"><span class="keyword">FROM</span> OrderItems</span><br><span class="line"><span class="keyword">WHERE</span> order_num <span class="operator">=</span> <span class="number">20008</span>;</span><br></pre></td></tr></tbody></table></figure>
<p>上面语句中的<code>expanded_price</code>列是一个计算字段。</p>
<h2 id="第7课-使用函数处理数据"><a href="#第7课-使用函数处理数据" class="headerlink" title="第7课 使用函数处理数据"></a>第7课 使用函数处理数据</h2><h2 id="第8课-分组数据"><a href="#第8课-分组数据" class="headerlink" title="第8课 分组数据"></a>第8课 分组数据</h2><h2 id="8-1-创建分组"><a href="#8-1-创建分组" class="headerlink" title="8.1 创建分组"></a>8.1 创建分组</h2><p>分组是使用<code>SELECT</code>语句的<code>GROUP BY</code>子句建立的，来看下面的例子：</p>
<figure class="highlight sql"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> vend_id,<span class="built_in">COUNT</span>(<span class="operator">*</span>) <span class="keyword">AS</span> num_prods</span><br><span class="line"><span class="keyword">FROM</span> Products</span><br><span class="line"><span class="keyword">GROUP</span> <span class="keyword">BY</span> vend_id;</span><br></pre></td></tr></tbody></table></figure>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/SQL-%E6%95%B0%E6%8D%AE%E5%BA%93/" rel="tag"># -SQL -数据库</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2023/04/09/Javasript%E9%AB%98%E7%BA%A7%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="prev" title="Javasript高级程序设计(红宝书)读书笔记">
                  <i class="fa fa-chevron-left"></i> Javasript高级程序设计(红宝书)读书笔记
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2023/04/23/%E6%95%B0%E6%8D%AE%E5%BA%93%E5%8E%9F%E7%90%86%EF%BC%9A%E6%95%B0%E6%8D%AE%E6%A8%A1%E5%9E%8B/" rel="next" title="数据模型">
                  数据模型 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">鸣蜩十七</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/muse/" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>
  <div class="sidebar-dimmer"></div>
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>

  




  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>



</body>
</html>
